# -*- coding:utf-8 -*-
import cv2 as cv
import sys


if __name__ == '__main__':
    # 读取图像face1.png和face2.png
    fileName = '5'
    image1 = cv.imread('images/'+fileName+'.jpg', cv.IMREAD_ANYCOLOR)
    #image2 = cv.imread('2.jpg', cv.IMREAD_ANYCOLOR)
    # if image1 is None or image2 is None:
    #     print('Failed to read face1.png or face2.png.')
    #     sys.exit()

    # 验证不同滤波器直径的滤波效果(图像，滤波器直径，颜色空间滤波器的标准差，空间坐标中滤波器的标准差）
    res1 = cv.bilateralFilter(image1, 25, 1000, 500)
    # res2 = cv.bilateralFilter(image1, 25, 300, 500)
    #
    # # 验证不同标准差值的滤波效果
    # res3 = cv.bilateralFilter(image1, 25, 300, 1000)
    # res4 = cv.bilateralFilter(image1, 25, 300, 2000)

    # 展示结果
    cv.imshow('Origin_image1', image1)
    #cv.imshow('Origin_image2', image2)
    cv.imshow('Result1', res1)
    # cv.imshow('Result2', res2)
    # cv.imshow('Result3', res3)
    # cv.imshow('Result4', res4)
    cv.imwrite('images/'+fileName+'filter.jpg', res1)

    cv.waitKey(0)
    cv.destroyAllWindows()